package com.hawk.eye.server.convert;

import com.hawk.eye.common.model.ServiceConfigMessage;
import com.hawk.eye.server.domain.dto.req.ServiceConfigReqDTO;
import com.hawk.eye.server.domain.dto.resp.ServiceConfigDetailRespDTO;
import com.hawk.eye.server.domain.dto.resp.ServiceConfigRespDTO;
import com.hawk.eye.server.domain.po.ServiceConfig;
import com.hawk.eye.server.domain.vo.req.ServiceConfigReqVO;
import com.hawk.eye.server.domain.vo.resp.ServiceConfigDetailRespVO;
import com.hawk.eye.server.domain.vo.resp.ServiceConfigRespVO;
import org.mapstruct.IterableMapping;
import org.mapstruct.Mapper;
import org.mapstruct.Named;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author zd
 */
@Mapper
public interface ServiceConfigConvert {

    ServiceConfigConvert INSTANCE = Mappers.getMapper(ServiceConfigConvert.class);

    ServiceConfigReqDTO reqVoToReqDto(ServiceConfigReqVO reqVO);

    @Named(value = "poToRespDto")
    ServiceConfigRespDTO poToRespDto(ServiceConfig t);

    ServiceConfigRespVO respDtoToRespVo(ServiceConfigRespDTO t);

    ServiceConfig reqDtoToPo(ServiceConfigReqDTO reqDTO);

    ServiceConfigDetailRespDTO to(ServiceConfig serviceConfig);

    @IterableMapping(qualifiedByName = "poToRespDto")
    List<ServiceConfigRespDTO> to(List<ServiceConfig> serviceConfigs);

    ServiceConfigDetailRespVO to(ServiceConfigDetailRespDTO respDTO);

    ServiceConfigMessage to2(ServiceConfig serviceConfig);

}